<?php
/**
 * Created by PhpStorm
 * USER:  Zhaoys
 * Date:  2025/7/9
 */

namespace Hj212\pack;

class Message
{
    // 包头 2
    const HEADER = "##";

    //包尾
    const FOOTER = "\r\n";

    // 精确到毫秒的时间戳:QN=YYYYMMDDhhmmsszzz，用来唯一标识一次命令交互 20
    private  $qn;
    //系统编码 20
    private  $st;
    //命令编码
    private  $cn;
    // 访问密码 9
    private $pw;
    //设备唯一标志mn 27
    //长度比特 标头8 + 厂商识别代码28 +  对象分类代码24  + 序列号36
    private $mn;
    private $flag;
    //指令参数cp
    private $cp;
    //总包数 PNUM  不分包时可以没有本字段，与标志位有关
    private $pnum;
    //包号 PNO   指示当前数据包的包号  分包时可以没有本字段，与标志位有关
    private $pno;
    // 数据段长度 4
    private $length;
    // 数据段 1024
    private $segment;
    private $segmentLength;
    // crc校验 4
    private $crc;
    //数据字符串
    private $dataStr;

    /**
     * @return mixed
     */
    public function getSegmentLength()
    {
        return $this->segmentLength;
    }

    /**
     * @param mixed $segmentLength
     */
    public function setSegmentLength($segmentLength)
    {
        $this->segmentLength = $segmentLength;
    }


    /**
     * @return mixed
     */
    public function getQn()
    {
        return $this->qn;
    }

    /**
     * @param mixed $qn
     */
    public function setQn($qn)
    {
        $this->qn = $qn;
    }

    /**
     * @return mixed
     */
    public function getSt()
    {
        return $this->st;
    }

    /**
     * @param mixed $st
     */
    public function setSt($st)
    {
        $this->st = $st;
    }

    /**
     * @return mixed
     */
    public function getCn()
    {
        return $this->cn;
    }

    /**
     * @param mixed $cn
     */
    public function setCn($cn)
    {
        $this->cn = $cn;
    }

    /**
     * @return mixed
     */
    public function getPw()
    {
        return $this->pw;
    }

    /**
     * @param mixed $pw
     */
    public function setPw($pw)
    {
        $this->pw = $pw;
    }

    /**
     * @return mixed
     */
    public function getMn()
    {
        return $this->mn;
    }

    /**
     * @param mixed $mn
     */
    public function setMn($mn)
    {
        $this->mn = $mn;
    }

    /**
     * @return mixed
     */
    public function getFlag()
    {
        return $this->flag;
    }

    /**
     * @param mixed $flag
     */
    public function setFlag($flag)
    {
        $this->flag = $flag;
    }

    /**
     * @return mixed
     */
    public function getCp()
    {
        return $this->cp;
    }

    /**
     * @param mixed $cp
     */
    public function setCp($cp)
    {
        $this->cp = $cp;
    }

    /**
     * @return mixed
     */
    public function getPnum()
    {
        return $this->pnum;
    }

    /**
     * @param mixed $pnum
     */
    public function setPnum($pnum)
    {
        $this->pnum = $pnum;
    }

    /**
     * @return mixed
     */
    public function getPno()
    {
        return $this->pno;
    }

    /**
     * @param mixed $pno
     */
    public function setPno($pno)
    {
        $this->pno = $pno;
    }

    /**
     * @return mixed
     */
    public function getLength()
    {
        return $this->length;
    }

    /**
     * @param mixed $length
     */
    public function setLength($length)
    {
        $this->length = $length;
    }

    /**
     * @return mixed
     */
    public function getSegment()
    {
        return $this->segment;
    }

    /**
     * @param mixed $segment
     */
    public function setSegment($segment)
    {
        $this->segment = $segment;
    }

    /**
     * @return mixed
     */
    public function getCrc()
    {
        return $this->crc;
    }

    /**
     * @param mixed $crc
     */
    public function setCrc($crc)
    {
        $this->crc = $crc;
    }

    /**
     * @return mixed
     */
    public function getDataStr()
    {
        return $this->dataStr;
    }

    /**
     * @param mixed $dataStr
     */
    public function setDataStr($dataStr)
    {
        $this->dataStr = $dataStr;
    }


}